/**
 * desc:表格中展示第三方商品信息html
 * @item {object} 商品的信息(两行展示)
 *
 */
import React from 'react';
import { formatAmount } from '@/utils/utils.jsx';
import CommonParagraph from '@/components/CommonParagraph';
import CommonSysImg from '@/components/CommonImg/SysComponent';
import styles from './index.module.less';

export default ({ item = {}, isPrice = false, hasGoodsCode = false }) => {
  const {
    goodsImage,
    goodsName,
    skuName,
    goodsPrice,
    skuId,
    isCarefullySelected,
  } = item;
  return (
    <div className={styles.wrap}>
      {/* <div className={styles.imgWrap}>{renderImg(path, src)}</div> */}
      <div className={styles.imgWrap}>
        <CommonSysImg
          img={goodsImage}
          isCloudIcon={isCarefullySelected == '1' ? true : false}
        />
      </div>
      <div>
        <div style={{ whiteSpace: 'pre-wrap' }}>
          <div>{goodsName}</div>
          <div>
            {skuName}
            <CommonParagraph
              text={skuName ? `${goodsName} ${skuName}` : `${goodsName}`}
            />
          </div>
        </div>
        {hasGoodsCode && <span>商品编码：{skuId}</span>}
        {isPrice && (
          <p className="common-color5">
            价格：
            <span className="common-color9">¥{formatAmount(goodsPrice)}</span>
          </p>
        )}
      </div>
    </div>
  );
};
